import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
 * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
 *                                if not set alwaysShow, only more than one route under the children
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
 **/
export const constantRouterMap = [{
		path: '/login',
		component: () => import('@/views/login/index'),
		hidden: true
	},
	{
		path: '/404',
		component: () => import('@/views/404'),
		hidden: true
	},
	{
		path: '',
		component: Layout,
		redirect: '/dashboard',
		children: [{
			path: 'dashboard',
			name: 'Dashboard',
			component: () => import('@/views/Dashboard'),
			meta: {
				title: '系统首页',
				icon: 'icon_home'
			}
		}]
	}
]

export const asyncRouterMap = [{
		path: '/question',
		component: Layout,
		redirect: '/question/createQuestion',
		meta: {
			title: '题库管理',
			icon: "icon_tkgl"
		},
		children: [{
				path: 'createQuestion',
				name: "CreateQuestion",
				component: () => import('@/views/question/createQuestion.vue'),
				meta: {
					title: '新建试题'
				},
			},
			{
				path: 'createSmallQuestion',
				name: "CreateSmallQuestion",
				component: () => import('@/views/question/createSmallQuestion.vue'),
				meta: {
					title: '新建小试题'
				},
			},
			{
				path: 'questionLibrary',
				name: 'QuestionLibrary',
				component: () => import('@/views/question/QuestionLibrary.vue'),
				meta: {
					title: '试题列表'
				}
			},
			{
				path: 'smallQuestionLibrary',
				name: "SmallQuestionLibrary",
				component: () => import('@/views/question/smallQuestionLibrary.vue'),
				meta: {
					title: '小试题列表'
				}
			},
			{
				path: 'trainlQuestion',
				name: "TrainlQuestion",
				component: () => import('@/views/question/trainlQuestion.vue'),
				meta: {
					title: '机构题库'
				}
			},
			{
				path: 'tagManage',
				name: "TagManage",
				component: () => import('@/views/question/tagManage.vue'),
				meta: {
					title: '标签管理'
				}
			},
			{
				path: 'questionSort',
				name: "QuestionSort",
				component: () => import('@/views/question/QuestionSortTable.vue'),
				meta: {
					title: '试题分类'
				}
			},
			{
				path: 'questionType',
				name: 'QuestionType',
				component: () => import('@/views/question/QuestionTypeTable.vue'),
				meta: {
					title: '题型管理'
				}
			},
			{
				path: 'questionUpload',
				name: 'QuestionUpload',
				component: () => import('@/views/question/questionUpload.vue'),
				meta: {
					title: '试题上传'
				}
			}
		]
	},
	{
		path: '/questionRelated',
		component: Layout,
		redirect: '/questionRelated/topicCorrection',
		meta: {
			title: '题库相关管理',
			icon: "icon_tkxggl"
		},
		children: [{
				path: 'topicCorrection',
				name: 'TopicCorrection',
				component: () => import('@/views/questionRelated/topicCorrection.vue'),
				meta: {
					title: '题目纠错'
				}
			},
			{
				path: 'examManage',
				name: "ExamManage",
				component: () => import('@/views/questionRelated/examManage.vue'),
				meta: {
					title: '考点管理'
				}
			},
			{
				path: 'videoManage',
				name: "VideoManage",
				component: () => import('@/views/questionRelated/videoManage.vue'),
				meta: {
					title: '视频管理'
				}
			},
			{
				path: 'videoAdManage',
				name: "videoAdManage",
				component: () => import('@/views/questionRelated/videoAdManage.vue'),
				meta: {
					title: '视频广告管理'
				}
			},
			{
				path: 'questionComment',
				name: "QuestionComment",
				component: () => import('@/views/questionRelated/questionComment.vue'),
				meta: {
					title: '试题评论'
				}
			},
			{
				path: 'imageLibrary',
				name: "ImageLibrary",
				component: () => import('@/views/questionRelated/imageLibrary.vue'),
				meta: {
					title: '图片库'
				}
			}
		]
	},
	{
		path: '/questionManage',
		component: Layout,
		redirect: '/questionManage/QuestionChapter',
		alwaysShow: true,
		meta: {
			title: '试题管理',
			icon: "icon_stgl"
		},
		children: [{
				path: 'questionChapter',
				name: 'QuestionChapter',
				component: () => import('@/views/questionManage/questionChapter.vue'),
				meta: {
					title: '章节练习'
				}
			},
			{
				path: 'famousQuestion',
				name: 'FamousQuestion',
				component: () => import('@/views/questionManage/famousQuestion.vue'),
				meta: {
					title: '名师题库'
				}
			},
			{
				path: 'historicalQuestion',
				name: 'HistoricalQuestion',
				component: () => import('@/views/questionManage/historicalQuestion.vue'),
				meta: {
					title: '历年真题'
				}
			},
			{
				path: 'examPaperLibrary',
				name: 'ExamPaperLibrary',
				component: () => import('@/views/questionManage/examPaperLibrary.vue'),
				meta: {
					title: '试卷库'
				}
			},
			{
				path: 'modelMatch',
				name: 'ModelMatch',
				component: () => import('@/views/questionManage/modelMatch.vue'),
				meta: {
					title: '模考大赛'
				}
			},
			{
				path: 'randomQuestion',
				name: 'RandomQuestion',
				component: () => import('@/views/questionManage/randomQuestion.vue'),
				meta: {
					title: '每日练习'
				}
			},
		]
	},
	{
		path: '/specialManage',
		component: Layout,
		redirect: '/specialManage/specialList',
		meta: {
			title: '专题管理',
			icon: "icon_ztgl"
		},
		children: [{
				path: 'specialList',
				name: "SpecialList",
				component: () => import('@/views/specialManage/specialList.vue'),
				meta: {
					title: '专题列表'
				},
			},
			{
				path: 'specialComment',
				name: "SpecialComment",
				component: () => import('@/views/specialManage/specialComment.vue'),
				meta: {
					title: '专题评价'
				}
			}
		]
	},
	{
		path: '/mallManage',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '商城管理',
			icon: "icon_scgl"
		},
		children: [{
				path: 'commodity',
				name: 'Commodity',
				component: () => import('@/views/mallManage/commodity.vue'),
				meta: {
					title: '商品管理'
				}
			},
			{
				path: 'commodityClass',
				name: 'CommodityClass',
				component: () => import('@/views/mallManage/commodityClass.vue'),
				meta: {
					title: '商品分类'
				}
			},
			{
				path: 'scholar',
				name: 'Scholar',
				component: () => import('@/views/mallManage/scholar.vue'),
				meta: {
					title: '讲师管理'
				}
			},
			{
				path: 'rate',
				name: 'Rate',
				component: () => import('@/views/mallManage/rate.vue'),
				meta: {
					title: '商品评价'
				}
			},
			{
				path: 'courseVideoManage',
				name: 'CourseVideoManage',
				component: () => import('@/views/mallManage/courseVideoManage.vue'),
				meta: {
					title: '课程视频管理'
				}
			},
			{
				path: 'productRecommend',
				name: 'ProductRecommend',
				component: () => import('@/views/mallManage/productRecommend.vue'),
				meta: {
					title: '首页商品推荐'
				}
			}
		]
	},
	{
		path: '/merchantManage',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '商家管理',
			icon: "icon_sjgl"
		},
		children: [{
				path: 'merchantList',
				name: 'MerchantList',
				component: () => import('@/views/merchantManage/merchantList.vue'),
				meta: {
					title: '商家列表'
				}
			},
			{
				path: 'ranking',
				name: 'Ranking',
				component: () => import('@/views/merchantManage/ranking.vue'),
				meta: {
					title: '排名管理'
				}
			},
			{
				path: 'comment',
				name: 'Comment',
				component: () => import('@/views/merchantManage/comment.vue'),
				meta: {
					title: '评价管理'
				}
			},
			{
				path: 'settledApply',
				name: 'SettledApply',
				component: () => import('@/views/merchantManage/settledApply.vue'),
				meta: {
					title: '入驻申请'
				}
			},
			{
				path: 'registration',
				name: 'Registration',
				component: () => import('@/views/merchantManage/registration.vue'),
				meta: {
					title: '报名申请'
				}
			},
			{
				path: 'institutionClaim',
				name: 'InstitutionClaim',
				component: () => import('@/views/merchantManage/institutionClaim.vue'),
				meta: {
					title: '机构认领'
				}
			},
			{
				path: 'lecturerList',
				name: 'LecturerList',
				component: () => import('@/views/merchantManage/lecturerList.vue'),
				meta: {
					title: '讲师管理'
				}
			},
			{
				path: 'ticklingList',
				name: 'TicklingList',
				component: () => import('@/views/merchantManage/ticklingList.vue'),
				meta: {
					title: '机构反馈管理'
				}
			},
			{
				path: 'lecturerfeedback',
				name: 'Lecturerfeedback',
				component: () => import('@/views/merchantManage/lecturerfeedback.vue'),
				meta: {
					title: '讲师投诉管理'
				}
			},
			{
				path: 'salesmanList',
				name: 'SalesmanList',
				component: () => import('@/views/merchantManage/salesmanList.vue'),
				meta: {
					title: '业务员管理'
				}
			},
			{
				path: 'subjectList',
				name: 'SubjectList',
				component: () => import('@/views/merchantManage/subjectList.vue'),
				meta: {
					title: '讲师科目管理'
				}
			},
			{
				path: 'examPapersList',
				name: 'ExamPapersList',
				component: () => import('@/views/merchantManage/examPapersList.vue'),
				meta: {
					title: '商家历年真题'
				}
			},
			{
				path: 'noticeList',
				name: 'NoticeList',
				component: () => import('@/views/merchantManage/noticeList.vue'),
				meta: {
					title: '商家简章公告'
				}
			},
			{
				path: 'navigationList',
				name: 'NavigationList',
				component: () => import('@/views/merchantManage/navigationList.vue'),
				meta: {
					title: '机构导航设置'
				}
			},
			// 
		]
	},
	{
		path: '/orderManage',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '订单管理',
			icon: "icon_yxgl"
		},
		children: [{
				path: 'shopOrder',
				name: 'ShopOrder',
				component: () => import('@/views/orderManage/shopOrder.vue'),
				meta: {
					title: '商品订单管理'
				}
			},
			{
				path: 'subjectOrder',
				name: 'SubjectOrder',
				component: () => import('@/views/orderManage/subjectOrder.vue'),
				meta: {
					title: '专题订单管理'
				}
			},
			{
				path: 'withdrawalManage',
				name: 'WithdrawalManage',
				component: () => import('@/views/orderManage/withdrawalManage.vue'),
				meta: {
					title: '提现管理'
				}
			}
		]
	},
	{
		path: '/marketingManage',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '营销管理',
			icon: "icon_yxgl"
		},
		children: [{
				path: 'accountExchangeCode',
				name: 'AccountExchangeCode',
				component: () => import('@/views/marketingManage/accountExchangeCode.vue'),
				meta: {
					title: '兑换码管理'
				}
			},
			{
				path: 'coupon',
				name: 'Coupon',
				component: () => import('@/views/marketingManage/coupon.vue'),
				meta: {
					title: '优惠券'
				}
			}
		]
	},
	{
		path: '/userManage',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '用户管理',
			icon: "icon_yhgl"
		},
		children: [{
				path: 'userList',
				name: 'UserList',
				component: () => import('@/views/userManage/userList.vue'),
				meta: {
					title: '用户列表'
				}
			},
			{
				path: 'noteManage',
				name: 'NoteManage',
				component: () => import('@/views/userManage/noteManage.vue'),
				meta: {
					title: '笔记管理'
				}
			}
		]
	},
	{
		path: '/brochureAnnouncement',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '简章公告',
			icon: "icon_jzgl"
		},
		children: [{
			path: 'announcement',
			name: 'Announcement',
			component: () => import('@/views/brochureAnnouncement/announcement.vue'),
			meta: {
				title: '简章公告列表'
			}
		}]
	},
	{
		path: '/experienceManage',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '经验管理',
			icon: "experienceManage"
		},
		children: [{
			path: 'experienceList',
			name: 'ExperienceList',
			component: () => import('@/views/experienceManage/experienceList.vue'),
			meta: {
				title: '经验管理列表'
			}
		}]
	},
	{
		path: '/messageManage',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '消息管理',
			icon: "messageManage"
		},
		children: [{
			path: 'messageList',
			name: 'MessageList',
			component: () => import('@/views/messageManage/messageList.vue'),
			meta: {
				title: '消息管理列表'
			}
		}]
	},
	{
		path: '/advertisementManage',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '广告管理',
			icon: "advertisementManage"
		},
		children: [{
			path: 'advertisementList',
			name: 'AdvertisementList',
			component: () => import('@/views/advertisementManage/advertisementList.vue'),
			meta: {
				title: '广告管理'
			}
		}]
	},
	{
		path: '/systemSetting',
		component: Layout,
		alwaysShow: true,
		meta: {
			title: '系统设置',
			icon: "icon_xtgl"
		},
		children: [{
				path: 'contentAssociation',
				name: 'ContentAssociation',
				component: () => import('@/views/systemSetting/contentAssociation.vue'),
				meta: {
					title: '内容关联设置'
				}
			}, {
				path: 'sysSetting',
				name: 'SysSetting',
				component: () => import('@/views/systemSetting/SysSetting.vue'),
				meta: {
					title: '系统参数'
				}
			},
			{
				path: 'minApp',
				name: 'MinApp',
				component: () => import('@/views/systemSetting/minApp.vue'),
				meta: {
					title: '科目管理'
				}
			},
			{
				path: 'feedBack',
				name: 'FeedBack',
				component: () => import('@/views/systemSetting/FeedBack.vue'),
				meta: {
					title: '意见反馈'
				}
			},
			{
				path: 'roleManage',
				name: 'RoleManage',
				component: () => import('@/views/role/list.vue'),
				meta: {
					title: '角色权限'
				}
			},
			{
				path: 'systemUserManage',
				name: 'SystemUserManage',
				component: () => import('@/views/adminUser/list.vue'),
				meta: {
					title: '系统用户'
				}
			},
			{
				path: 'messagePush',
				name: 'MessagePush',
				component: () => import('@/views/systemSetting/MessagePush.vue'),
				meta: {
					title: '消息通知'
				}
			},
			{
				path: 'badWord',
				name: 'BadWord',
				component: () => import('@/views/systemSetting/BadWord.vue'),
				meta: {
					title: '敏感词管理'
				}
			},
			{
				path: 'moduleType',
				name: 'ModuleType',
				component: () => import('@/views/systemSetting/ModuleType.vue'),
				meta: {
					title: '导航图标管理'
				}
			},
			{
				path: 'helpCenter',
				name: 'HelpCenter',
				component: () => import('@/views/systemSetting/HelpCenter.vue'),
				meta: {
					title: '帮助中心'
				}
			},
			{
				path: 'area',
				name: 'Area',
				component: () => import('@/views/systemSetting/Area.vue'),
				meta: {
					title: '地区管理'
				}
			},
			{
				path: 'apkSetting',
				name: 'ApkSetting',
				component: () => import('@/views/systemSetting/ApkSetting.vue'),
				meta: {
					title: 'apk更新管理'
				}
			},
		]
	}
]

export default new Router({
	// mode: 'history', //后端支持可开
	scrollBehavior: () => ({
		y: 0
	}),
	routes: constantRouterMap
})